package com.google.ads;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
import android.util.TypedValue;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.Window;
import android.widget.FrameLayout;
import android.widget.FrameLayout.LayoutParams;
import android.widget.ImageButton;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import com.google.ads.b.a;
import com.google.ads.b.c;
import com.google.ads.b.e;
import com.google.ads.b.r;
import com.google.ads.b.s;
import com.google.ads.b.y;
import com.google.ads.util.AdUtil;
import com.google.ads.util.ac;
import com.google.ads.util.ad;
import com.google.ads.util.d;
import com.google.ads.util.m;
import com.google.ads.util.n;
import java.util.HashMap;
import java.util.Map;

public class AdActivity extends Activity
  implements View.OnClickListener
{
  private static final e a = (e)e.a.b();
  private static final Object b = new Object();
  private static AdActivity c = null;
  private static r d = null;
  private static AdActivity e = null;
  private static AdActivity f = null;
  private static final b g = new b();
  private c h;
  private FrameLayout i;
  private int j;
  private ViewGroup k = null;
  private boolean l;
  private long m;
  private RelativeLayout n;
  private AdActivity o = null;
  private boolean p;
  private boolean q;
  private boolean r;
  private boolean s;
  private a t;

  public static void a(r paramr, s params)
  {
    g.a(paramr, params);
  }

  private void a(String paramString)
  {
    d.b(paramString);
    finish();
  }

  private void a(String paramString, Throwable paramThrowable)
  {
    d.b(paramString, paramThrowable);
    finish();
  }

  private RelativeLayout.LayoutParams c(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    RelativeLayout.LayoutParams localLayoutParams = new RelativeLayout.LayoutParams(paramInt3, paramInt4);
    localLayoutParams.setMargins(paramInt1, paramInt2, 0, 0);
    localLayoutParams.addRule(10);
    localLayoutParams.addRule(9);
    return localLayoutParams;
  }

  public static boolean c()
  {
    return g.a();
  }

  private void g()
  {
    if (!this.l)
      if (this.h != null)
      {
        a.b(this.h);
        this.h.setAdActivity(null);
        this.h.setIsExpandedMraid(false);
        if ((!this.q) && (this.n != null) && (this.k != null))
        {
          if ((!this.r) || (this.s))
            break label238;
          d.a("Disabling hardware acceleration on collapsing MRAID WebView.");
          this.h.b();
        }
      }
    while (true)
    {
      this.n.removeView(this.h);
      this.k.addView(this.h);
      if (this.t != null)
      {
        this.t.e();
        this.t = null;
      }
      if (this == c)
        c = null;
      f = this.o;
      synchronized (b)
      {
        if ((d != null) && (this.q) && (this.h != null))
        {
          if (this.h == d.j())
            d.a();
          this.h.stopLoading();
        }
        if (this == e)
        {
          e = null;
          if (d != null)
          {
            d.r();
            d = null;
          }
        }
        else
        {
          this.l = true;
          d.a("AdActivity is closing.");
          return;
          label238: if ((this.r) || (!this.s))
            continue;
          d.a("Re-enabling hardware acceleration on collapsing MRAID WebView.");
          this.h.c();
          continue;
        }
        d.e("currentAdManager is null while trying to destroy AdActivity.");
      }
    }
  }

  protected View a(int paramInt, boolean paramBoolean)
  {
    this.j = ((int)TypedValue.applyDimension(1, paramInt, getResources().getDisplayMetrics()));
    this.i = new FrameLayout(getApplicationContext());
    this.i.setMinimumWidth(this.j);
    this.i.setMinimumHeight(this.j);
    this.i.setOnClickListener(this);
    a(paramBoolean);
    return this.i;
  }

  public a a()
  {
    return this.t;
  }

  protected a a(Activity paramActivity)
  {
    return new a(paramActivity, this.h);
  }

  public void a(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    if (this.t != null)
    {
      this.t.setLayoutParams(c(paramInt1, paramInt2, paramInt3, paramInt4));
      this.t.requestLayout();
    }
  }

  protected void a(c paramc, boolean paramBoolean1, int paramInt, boolean paramBoolean2, boolean paramBoolean3)
  {
    requestWindowFeature(1);
    Window localWindow = getWindow();
    localWindow.setFlags(1024, 1024);
    if (AdUtil.a >= 11)
    {
      if (!this.r)
        break label105;
      d.a("Enabling hardware acceleration on the AdActivity window.");
      n.a(localWindow);
    }
    while (true)
    {
      ViewParent localViewParent = paramc.getParent();
      if (localViewParent != null)
      {
        if (!paramBoolean2)
          break label126;
        if (!(localViewParent instanceof ViewGroup))
          break;
        this.k = ((ViewGroup)localViewParent);
        this.k.removeView(paramc);
      }
      if (paramc.d() == null)
        break label134;
      a("Interstitial created with an AdWebView that is already in use by another AdActivity.");
      return;
      label105: d.a("Disabling hardware acceleration on the AdActivity WebView.");
      paramc.b();
    }
    a("MRAID banner was not a child of a ViewGroup.");
    return;
    label126: a("Interstitial created with an AdWebView that has a parent.");
    return;
    label134: setRequestedOrientation(paramInt);
    paramc.setAdActivity(this);
    int i1;
    label153: View localView;
    RelativeLayout.LayoutParams localLayoutParams;
    if (paramBoolean2)
    {
      i1 = 50;
      localView = a(i1, paramBoolean3);
      this.n.addView(paramc, -1, -1);
      localLayoutParams = new RelativeLayout.LayoutParams(-2, -2);
      if (!paramBoolean2)
        break label264;
      localLayoutParams.addRule(10);
      localLayoutParams.addRule(11);
    }
    while (true)
    {
      this.n.addView(localView, localLayoutParams);
      this.n.setKeepScreenOn(true);
      setContentView(this.n);
      this.n.getRootView().setBackgroundColor(-16777216);
      if (!paramBoolean1)
        break;
      a.a(paramc);
      return;
      i1 = 32;
      break label153;
      label264: localLayoutParams.addRule(10);
      localLayoutParams.addRule(9);
    }
  }

  protected void a(r paramr)
  {
    this.h = null;
    this.m = SystemClock.elapsedRealtime();
    this.p = true;
    synchronized (b)
    {
      if (c == null)
      {
        c = this;
        paramr.t();
      }
      return;
    }
  }

  protected void a(HashMap paramHashMap, r paramr)
  {
    Intent localIntent = new Intent();
    localIntent.setComponent(new ComponentName("com.google.android.apps.plus", "com.google.android.apps.circles.platform.PlusOneActivity"));
    localIntent.addCategory("android.intent.category.LAUNCHER");
    localIntent.putExtras(getIntent().getExtras());
    localIntent.putExtra("com.google.circles.platform.intent.extra.ENTITY", (String)paramHashMap.get("u"));
    localIntent.putExtra("com.google.circles.platform.intent.extra.ENTITY_TYPE", x.a.c);
    localIntent.putExtra("com.google.circles.platform.intent.extra.ACTION", (String)paramHashMap.get("a"));
    a(paramr);
    try
    {
      d.a("Launching Google+ intent from AdActivity.");
      startActivityForResult(localIntent, 0);
      return;
    }
    catch (ActivityNotFoundException localActivityNotFoundException)
    {
      a(localActivityNotFoundException.getMessage(), localActivityNotFoundException);
    }
  }

  public void a(boolean paramBoolean)
  {
    if (this.i != null)
    {
      this.i.removeAllViews();
      if (!paramBoolean)
      {
        ImageButton localImageButton = new ImageButton(this);
        localImageButton.setImageResource(17301527);
        localImageButton.setBackgroundColor(0);
        localImageButton.setOnClickListener(this);
        localImageButton.setPadding(0, 0, 0, 0);
        FrameLayout.LayoutParams localLayoutParams = new FrameLayout.LayoutParams(this.j, this.j, 17);
        this.i.addView(localImageButton, localLayoutParams);
      }
    }
  }

  public c b()
  {
    if (this.o != null)
      return this.o.h;
    synchronized (b)
    {
      if (d == null)
      {
        d.e("currentAdManager was null while trying to get the opening AdWebView.");
        return null;
      }
    }
    c localc = d.j();
    if (localc != this.h)
      return localc;
    return null;
  }

  public void b(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    if (this.t == null)
    {
      this.t = a(this);
      this.n.addView(this.t, 0, c(paramInt1, paramInt2, paramInt3, paramInt4));
      synchronized (b)
      {
        if (d == null)
        {
          d.e("currentAdManager was null while trying to get the opening AdWebView.");
          return;
        }
        d.k().b(false);
        return;
      }
    }
  }

  protected void b(HashMap paramHashMap, r paramr)
  {
    if (paramHashMap == null)
    {
      a("Could not get the paramMap in launchIntent()");
      return;
    }
    String str1 = (String)paramHashMap.get("u");
    if (str1 == null)
    {
      a("Could not get the URL parameter in launchIntent().");
      return;
    }
    String str2 = (String)paramHashMap.get("i");
    String str3 = (String)paramHashMap.get("m");
    Uri localUri = Uri.parse(str1);
    if (str2 == null);
    for (Intent localIntent = new Intent("android.intent.action.VIEW", localUri); ; localIntent = new Intent(str2, localUri))
    {
      if (str3 != null)
        localIntent.setDataAndType(localUri, str3);
      a(paramr);
      try
      {
        d.a("Launching an intent from AdActivity: " + localIntent.getAction() + " - " + localUri);
        startActivity(localIntent);
        return;
      }
      catch (ActivityNotFoundException localActivityNotFoundException)
      {
        a(localActivityNotFoundException.getMessage(), localActivityNotFoundException);
        return;
      }
    }
  }

  public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    super.onActivityResult(paramInt1, paramInt2, paramIntent);
    String str2;
    if ((b() != null) && (paramIntent != null) && (paramIntent.getExtras() != null) && (paramIntent.getExtras().getString("com.google.circles.platform.result.extra.CONFIRMATION") != null) && (paramIntent.getExtras().getString("com.google.circles.platform.result.extra.ACTION") != null))
    {
      String str1 = paramIntent.getExtras().getString("com.google.circles.platform.result.extra.CONFIRMATION");
      str2 = paramIntent.getExtras().getString("com.google.circles.platform.result.extra.ACTION");
      if (str1.equals("yes"))
      {
        if (!str2.equals("insert"))
          break label110;
        q.a(b(), true);
      }
    }
    while (true)
    {
      finish();
      return;
      label110: if (str2.equals("delete"))
        q.a(b(), false);
    }
  }

  public void onClick(View paramView)
  {
    finish();
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.l = false;
    r localr;
    boolean bool1;
    Bundle localBundle;
    while (true)
    {
      synchronized (b)
      {
        if (d != null)
        {
          localr = d;
          if (e == null)
          {
            e = this;
            localr.s();
          }
          if ((this.o == null) && (f != null))
            this.o = f;
          f = this;
          if (((localr.g().a()) && (e == this)) || ((localr.g().b()) && (this.o == e)))
            localr.u();
          bool1 = localr.p();
          ar localar = (ar)((aq)localr.g().a.a()).a.a();
          if (AdUtil.a >= ((Integer)localar.a.a()).intValue())
          {
            bool2 = true;
            this.s = bool2;
            if (AdUtil.a < ((Integer)localar.b.a()).intValue())
              break label268;
            bool3 = true;
            this.r = bool3;
            this.n = null;
            this.p = false;
            this.q = true;
            this.t = null;
            localBundle = getIntent().getBundleExtra("com.google.ads.AdOpener");
            if (localBundle != null)
              break;
            a("Could not get the Bundle used to create AdActivity.");
          }
        }
        else
        {
          a("Could not get currentAdManager.");
          return;
        }
      }
      boolean bool2 = false;
      continue;
      label268: boolean bool3 = false;
    }
    s locals = new s(localBundle);
    String str1 = locals.b();
    HashMap localHashMap = locals.c();
    if (str1.equals("plusone"))
    {
      a(localHashMap, localr);
      return;
    }
    if (str1.equals("intent"))
    {
      b(localHashMap, localr);
      return;
    }
    this.n = new RelativeLayout(getApplicationContext());
    if (str1.equals("webapp"))
    {
      this.h = new c(localr.g(), null);
      Map localMap = e.c;
      boolean bool7;
      String str3;
      String str4;
      label486: String str5;
      int i2;
      label515: c localc;
      if (!bool1)
      {
        bool7 = true;
        y localy = y.a(localr, localMap, true, bool7);
        localy.d(true);
        if (bool1)
          localy.a(true);
        this.h.setWebViewClient(localy);
        String str2 = (String)localHashMap.get("u");
        str3 = (String)localHashMap.get("baseurl");
        str4 = (String)localHashMap.get("html");
        if (str2 == null)
          break label566;
        this.h.loadUrl(str2);
        str5 = (String)localHashMap.get("o");
        if (!"p".equals(str5))
          break label600;
        i2 = AdUtil.b();
        localc = this.h;
        if ((localHashMap == null) || (!"1".equals(localHashMap.get("custom_close"))))
          break label642;
      }
      label642: for (boolean bool8 = true; ; bool8 = false)
      {
        a(localc, false, i2, bool1, bool8);
        return;
        bool7 = false;
        break;
        label566: if (str4 != null)
        {
          this.h.loadDataWithBaseURL(str3, str4, "text/html", "utf-8", null);
          break label486;
        }
        a("Could not get the URL or HTML parameter to show a web app.");
        return;
        label600: if ("l".equals(str5))
        {
          i2 = AdUtil.a();
          break label515;
        }
        if (this == e)
        {
          i2 = localr.m();
          break label515;
        }
        i2 = -1;
        break label515;
      }
    }
    int i1;
    boolean bool5;
    boolean bool4;
    if ((str1.equals("interstitial")) || (str1.equals("expand")))
    {
      this.h = localr.j();
      i1 = localr.m();
      if (str1.equals("expand"))
      {
        this.h.setIsExpandedMraid(true);
        this.q = false;
        bool5 = false;
        if (localHashMap != null)
        {
          boolean bool6 = "1".equals(localHashMap.get("custom_close"));
          bool5 = false;
          if (bool6)
            bool5 = true;
        }
        if ((!this.r) || (this.s))
          break label836;
        d.a("Re-enabling hardware acceleration on expanding MRAID WebView.");
        this.h.c();
        bool4 = bool5;
      }
    }
    while (true)
    {
      a(this.h, true, i1, bool1, bool4);
      return;
      bool4 = this.h.e();
      continue;
      a("Unknown AdOpener, <action: " + str1 + ">");
      return;
      label836: bool4 = bool5;
    }
  }

  public void onDestroy()
  {
    if (this.n != null)
      this.n.removeAllViews();
    if (isFinishing())
    {
      g();
      if ((this.q) && (this.h != null))
      {
        this.h.stopLoading();
        this.h.destroy();
        this.h = null;
      }
    }
    super.onDestroy();
  }

  public void onPause()
  {
    if (isFinishing())
      g();
    super.onPause();
  }

  public void onWindowFocusChanged(boolean paramBoolean)
  {
    if ((this.p) && (paramBoolean) && (SystemClock.elapsedRealtime() - this.m > 250L))
    {
      d.d("Launcher AdActivity got focus and is closing.");
      finish();
    }
    super.onWindowFocusChanged(paramBoolean);
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.google.ads.AdActivity
 * JD-Core Version:    0.6.2
 */